* NOTE: You need to set the Stata working directory to the path
* where the data file is located.

set more off

cd "/Users/yilinzhuo/Dropbox/Prison_Covid/Yilin_exploratory/ZCTA_acs_15_19"

clear
quietly infix                   ///
  str     year       1-9        ///
  str     stusab     10-11      ///
  str     regiona    12-12      ///
  str     divisiona  13-13      ///
  str     statea     14-15      ///
  str     countya    16-18      ///
  str     cousuba    19-23      ///
  str     placea     24-28      ///
  str     tracta     29-34      ///
  str     blkgrpa    35-35      ///
  str     concita    36-40      ///
  str     aianhha    41-44      ///
  str     res_onlya  45-48      ///
  str     trusta     49-52      ///
  str     aihhtli    53-53      ///
  str     aits       54-58      ///
  str     anrca      59-63      ///
  str     cbsaa      64-68      ///
  str     csaa       69-71      ///
  str     metdiva    72-76      ///
  str     memi       77-77      ///
  str     nectaa     78-82      ///
  str     cnectaa    83-85      ///
  str     nectadiva  86-90      ///
  str     uaa        91-95      ///
  str     cdcurra    96-97      ///
  str     sldua      98-100     ///
  str     sldla      101-103    ///
  str     zcta5a     104-108    ///
  str     submcda    109-113    ///
  str     sdelma     114-118    ///
  str     sdseca     119-123    ///
  str     sdunia     124-128    ///
  str     ur         129-129    ///
  str     pci        130-130    ///
  str     puma5a     131-135    ///
  str     geoid      136-175    ///
  str     bttra      176-181    ///
  str     btbga      182-182    ///
  str     name_e     183-1182   ///
  double  alt0e001   1183-1191  ///
  double  alt0e002   1192-1200  ///
  double  alt0e003   1201-1209  ///
  double  alt0e004   1210-1218  ///
  double  alt0e005   1219-1227  ///
  double  alt0e006   1228-1236  ///
  double  alt0e007   1237-1245  ///
  double  alt0e008   1246-1254  ///
  double  alt0e009   1255-1263  ///
  double  alt0e010   1264-1272  ///
  double  alt0e011   1273-1281  ///
  double  alt0e012   1282-1290  ///
  double  alt0e013   1291-1299  ///
  double  alt0e014   1300-1308  ///
  double  alt0e015   1309-1317  ///
  double  alt0e016   1318-1326  ///
  double  alt0e017   1327-1335  ///
  double  alt0e018   1336-1344  ///
  double  alt0e019   1345-1353  ///
  double  alt0e020   1354-1362  ///
  double  alt0e021   1363-1371  ///
  double  alt0e022   1372-1380  ///
  double  alt0e023   1381-1389  ///
  double  alt0e024   1390-1398  ///
  double  alt0e025   1399-1407  ///
  double  alt0e026   1408-1416  ///
  double  alt0e027   1417-1425  ///
  double  alt0e028   1426-1434  ///
  double  alt0e029   1435-1443  ///
  double  alt0e030   1444-1452  ///
  double  alt0e031   1453-1461  ///
  double  alt0e032   1462-1470  ///
  double  alt0e033   1471-1479  ///
  double  alt0e034   1480-1488  ///
  double  alt0e035   1489-1497  ///
  double  alt0e036   1498-1506  ///
  double  alt0e037   1507-1515  ///
  double  alt0e038   1516-1524  ///
  double  alt0e039   1525-1533  ///
  double  alt0e040   1534-1542  ///
  double  alt0e041   1543-1551  ///
  double  alt0e042   1552-1560  ///
  double  alt0e043   1561-1569  ///
  double  alt0e044   1570-1578  ///
  double  alt0e045   1579-1587  ///
  double  alt0e046   1588-1596  ///
  double  alt0e047   1597-1605  ///
  double  alt0e048   1606-1614  ///
  double  alt0e049   1615-1623  ///
  double  alt1e001   1624-1632  ///
  double  alt1e002   1633-1641  ///
  double  alt1e003   1642-1650  ///
  double  alube001   1651-1659  ///
  double  aluce001   1660-1668  ///
  double  aluce002   1669-1677  ///
  double  aluce003   1678-1686  ///
  double  aluce004   1687-1695  ///
  double  aluce005   1696-1704  ///
  double  aluce006   1705-1713  ///
  double  aluce007   1714-1722  ///
  double  aluce008   1723-1731  ///
  double  aluce009   1732-1740  ///
  double  aluce010   1741-1749  ///
  double  aluke001   1750-1758  ///
  double  aluke002   1759-1767  ///
  double  aluke003   1768-1776  ///
  double  aluke004   1777-1785  ///
  double  aluke005   1786-1794  ///
  double  aluke006   1795-1803  ///
  double  aluke007   1804-1812  ///
  double  aluke008   1813-1821  ///
  double  aluke009   1822-1830  ///
  double  aluke010   1831-1839  ///
  double  aluke011   1840-1848  ///
  double  aluke012   1849-1857  ///
  double  aluke013   1858-1866  ///
  double  aluke014   1867-1875  ///
  double  aluke015   1876-1884  ///
  double  aluke016   1885-1893  ///
  double  aluke017   1894-1902  ///
  double  aluke018   1903-1911  ///
  double  aluke019   1912-1920  ///
  double  aluke020   1921-1929  ///
  double  aluke021   1930-1938  ///
  double  alwge001   1939-1947  ///
  double  alwge002   1948-1956  ///
  double  alwge003   1957-1965  ///
  double  alwge004   1966-1974  ///
  double  alwge005   1975-1983  ///
  double  alwge006   1984-1992  ///
  double  alwge007   1993-2001  ///
  double  alwge008   2002-2010  ///
  double  alwge009   2011-2019  ///
  double  alwge010   2020-2028  ///
  double  alwge011   2029-2037  ///
  double  alwge012   2038-2046  ///
  double  alwge013   2047-2055  ///
  double  alwge014   2056-2064  ///
  double  alwge015   2065-2073  ///
  double  alwge016   2074-2082  ///
  double  alwge017   2083-2091  ///
  double  alwge018   2092-2100  ///
  double  alwge019   2101-2109  ///
  double  alwge020   2110-2118  ///
  double  alwge021   2119-2127  ///
  double  alwge022   2128-2136  ///
  double  alwge023   2137-2145  ///
  double  alwge024   2146-2154  ///
  double  alwge025   2155-2163  ///
  double  alwve001   2164-2172  ///
  double  alwve002   2173-2181  ///
  double  alwve003   2182-2190  ///
  double  alwve004   2191-2199  ///
  double  alwve005   2200-2208  ///
  double  alwve006   2209-2217  ///
  double  alwve007   2218-2226  ///
  double  alwve008   2227-2235  ///
  double  alw1e001   2236-2244  ///
  double  aly3e001   2245-2253  ///
  double  aly3e002   2254-2262  ///
  double  aly3e003   2263-2271  ///
  double  aly3e004   2272-2280  ///
  double  aly3e005   2281-2289  ///
  double  aly3e006   2290-2298  ///
  double  aly3e007   2299-2307  ///
  str     name_m     2308-3307  ///
  double  alt0m001   3308-3316  ///
  double  alt0m002   3317-3325  ///
  double  alt0m003   3326-3334  ///
  double  alt0m004   3335-3343  ///
  double  alt0m005   3344-3352  ///
  double  alt0m006   3353-3361  ///
  double  alt0m007   3362-3370  ///
  double  alt0m008   3371-3379  ///
  double  alt0m009   3380-3388  ///
  double  alt0m010   3389-3397  ///
  double  alt0m011   3398-3406  ///
  double  alt0m012   3407-3415  ///
  double  alt0m013   3416-3424  ///
  double  alt0m014   3425-3433  ///
  double  alt0m015   3434-3442  ///
  double  alt0m016   3443-3451  ///
  double  alt0m017   3452-3460  ///
  double  alt0m018   3461-3469  ///
  double  alt0m019   3470-3478  ///
  double  alt0m020   3479-3487  ///
  double  alt0m021   3488-3496  ///
  double  alt0m022   3497-3505  ///
  double  alt0m023   3506-3514  ///
  double  alt0m024   3515-3523  ///
  double  alt0m025   3524-3532  ///
  double  alt0m026   3533-3541  ///
  double  alt0m027   3542-3550  ///
  double  alt0m028   3551-3559  ///
  double  alt0m029   3560-3568  ///
  double  alt0m030   3569-3577  ///
  double  alt0m031   3578-3586  ///
  double  alt0m032   3587-3595  ///
  double  alt0m033   3596-3604  ///
  double  alt0m034   3605-3613  ///
  double  alt0m035   3614-3622  ///
  double  alt0m036   3623-3631  ///
  double  alt0m037   3632-3640  ///
  double  alt0m038   3641-3649  ///
  double  alt0m039   3650-3658  ///
  double  alt0m040   3659-3667  ///
  double  alt0m041   3668-3676  ///
  double  alt0m042   3677-3685  ///
  double  alt0m043   3686-3694  ///
  double  alt0m044   3695-3703  ///
  double  alt0m045   3704-3712  ///
  double  alt0m046   3713-3721  ///
  double  alt0m047   3722-3730  ///
  double  alt0m048   3731-3739  ///
  double  alt0m049   3740-3748  ///
  double  alt1m001   3749-3757  ///
  double  alt1m002   3758-3766  ///
  double  alt1m003   3767-3775  ///
  double  alubm001   3776-3784  ///
  double  alucm001   3785-3793  ///
  double  alucm002   3794-3802  ///
  double  alucm003   3803-3811  ///
  double  alucm004   3812-3820  ///
  double  alucm005   3821-3829  ///
  double  alucm006   3830-3838  ///
  double  alucm007   3839-3847  ///
  double  alucm008   3848-3856  ///
  double  alucm009   3857-3865  ///
  double  alucm010   3866-3874  ///
  double  alukm001   3875-3883  ///
  double  alukm002   3884-3892  ///
  double  alukm003   3893-3901  ///
  double  alukm004   3902-3910  ///
  double  alukm005   3911-3919  ///
  double  alukm006   3920-3928  ///
  double  alukm007   3929-3937  ///
  double  alukm008   3938-3946  ///
  double  alukm009   3947-3955  ///
  double  alukm010   3956-3964  ///
  double  alukm011   3965-3973  ///
  double  alukm012   3974-3982  ///
  double  alukm013   3983-3991  ///
  double  alukm014   3992-4000  ///
  double  alukm015   4001-4009  ///
  double  alukm016   4010-4018  ///
  double  alukm017   4019-4027  ///
  double  alukm018   4028-4036  ///
  double  alukm019   4037-4045  ///
  double  alukm020   4046-4054  ///
  double  alukm021   4055-4063  ///
  double  alwgm001   4064-4072  ///
  double  alwgm002   4073-4081  ///
  double  alwgm003   4082-4090  ///
  double  alwgm004   4091-4099  ///
  double  alwgm005   4100-4108  ///
  double  alwgm006   4109-4117  ///
  double  alwgm007   4118-4126  ///
  double  alwgm008   4127-4135  ///
  double  alwgm009   4136-4144  ///
  double  alwgm010   4145-4153  ///
  double  alwgm011   4154-4162  ///
  double  alwgm012   4163-4171  ///
  double  alwgm013   4172-4180  ///
  double  alwgm014   4181-4189  ///
  double  alwgm015   4190-4198  ///
  double  alwgm016   4199-4207  ///
  double  alwgm017   4208-4216  ///
  double  alwgm018   4217-4225  ///
  double  alwgm019   4226-4234  ///
  double  alwgm020   4235-4243  ///
  double  alwgm021   4244-4252  ///
  double  alwgm022   4253-4261  ///
  double  alwgm023   4262-4270  ///
  double  alwgm024   4271-4279  ///
  double  alwgm025   4280-4288  ///
  double  alwvm001   4289-4297  ///
  double  alwvm002   4298-4306  ///
  double  alwvm003   4307-4315  ///
  double  alwvm004   4316-4324  ///
  double  alwvm005   4325-4333  ///
  double  alwvm006   4334-4342  ///
  double  alwvm007   4343-4351  ///
  double  alwvm008   4352-4360  ///
  double  alw1m001   4361-4369  ///
  double  aly3m001   4370-4378  ///
  double  aly3m002   4379-4387  ///
  double  aly3m003   4388-4396  ///
  double  aly3m004   4397-4405  ///
  double  aly3m005   4406-4414  ///
  double  aly3m006   4415-4423  ///
  double  aly3m007   4424-4432  ///
  using `"nhgis0014_ds244_20195_2019_zcta.dat"'

replace alt1e001  = alt1e001  / 10
replace alt1e002  = alt1e002  / 10
replace alt1e003  = alt1e003  / 10
replace alt1m001  = alt1m001  / 10
replace alt1m002  = alt1m002  / 10
replace alt1m003  = alt1m003  / 10

format alt0e001  %9.0f
format alt0e002  %9.0f
format alt0e003  %9.0f
format alt0e004  %9.0f
format alt0e005  %9.0f
format alt0e006  %9.0f
format alt0e007  %9.0f
format alt0e008  %9.0f
format alt0e009  %9.0f
format alt0e010  %9.0f
format alt0e011  %9.0f
format alt0e012  %9.0f
format alt0e013  %9.0f
format alt0e014  %9.0f
format alt0e015  %9.0f
format alt0e016  %9.0f
format alt0e017  %9.0f
format alt0e018  %9.0f
format alt0e019  %9.0f
format alt0e020  %9.0f
format alt0e021  %9.0f
format alt0e022  %9.0f
format alt0e023  %9.0f
format alt0e024  %9.0f
format alt0e025  %9.0f
format alt0e026  %9.0f
format alt0e027  %9.0f
format alt0e028  %9.0f
format alt0e029  %9.0f
format alt0e030  %9.0f
format alt0e031  %9.0f
format alt0e032  %9.0f
format alt0e033  %9.0f
format alt0e034  %9.0f
format alt0e035  %9.0f
format alt0e036  %9.0f
format alt0e037  %9.0f
format alt0e038  %9.0f
format alt0e039  %9.0f
format alt0e040  %9.0f
format alt0e041  %9.0f
format alt0e042  %9.0f
format alt0e043  %9.0f
format alt0e044  %9.0f
format alt0e045  %9.0f
format alt0e046  %9.0f
format alt0e047  %9.0f
format alt0e048  %9.0f
format alt0e049  %9.0f
format alt1e001  %9.1f
format alt1e002  %9.1f
format alt1e003  %9.1f
format alube001  %9.0f
format aluce001  %9.0f
format aluce002  %9.0f
format aluce003  %9.0f
format aluce004  %9.0f
format aluce005  %9.0f
format aluce006  %9.0f
format aluce007  %9.0f
format aluce008  %9.0f
format aluce009  %9.0f
format aluce010  %9.0f
format aluke001  %9.0f
format aluke002  %9.0f
format aluke003  %9.0f
format aluke004  %9.0f
format aluke005  %9.0f
format aluke006  %9.0f
format aluke007  %9.0f
format aluke008  %9.0f
format aluke009  %9.0f
format aluke010  %9.0f
format aluke011  %9.0f
format aluke012  %9.0f
format aluke013  %9.0f
format aluke014  %9.0f
format aluke015  %9.0f
format aluke016  %9.0f
format aluke017  %9.0f
format aluke018  %9.0f
format aluke019  %9.0f
format aluke020  %9.0f
format aluke021  %9.0f
format alwge001  %9.0f
format alwge002  %9.0f
format alwge003  %9.0f
format alwge004  %9.0f
format alwge005  %9.0f
format alwge006  %9.0f
format alwge007  %9.0f
format alwge008  %9.0f
format alwge009  %9.0f
format alwge010  %9.0f
format alwge011  %9.0f
format alwge012  %9.0f
format alwge013  %9.0f
format alwge014  %9.0f
format alwge015  %9.0f
format alwge016  %9.0f
format alwge017  %9.0f
format alwge018  %9.0f
format alwge019  %9.0f
format alwge020  %9.0f
format alwge021  %9.0f
format alwge022  %9.0f
format alwge023  %9.0f
format alwge024  %9.0f
format alwge025  %9.0f
format alwve001  %9.0f
format alwve002  %9.0f
format alwve003  %9.0f
format alwve004  %9.0f
format alwve005  %9.0f
format alwve006  %9.0f
format alwve007  %9.0f
format alwve008  %9.0f
format alw1e001  %9.0f
format aly3e001  %9.0f
format aly3e002  %9.0f
format aly3e003  %9.0f
format aly3e004  %9.0f
format aly3e005  %9.0f
format aly3e006  %9.0f
format aly3e007  %9.0f
format alt0m001  %9.0f
format alt0m002  %9.0f
format alt0m003  %9.0f
format alt0m004  %9.0f
format alt0m005  %9.0f
format alt0m006  %9.0f
format alt0m007  %9.0f
format alt0m008  %9.0f
format alt0m009  %9.0f
format alt0m010  %9.0f
format alt0m011  %9.0f
format alt0m012  %9.0f
format alt0m013  %9.0f
format alt0m014  %9.0f
format alt0m015  %9.0f
format alt0m016  %9.0f
format alt0m017  %9.0f
format alt0m018  %9.0f
format alt0m019  %9.0f
format alt0m020  %9.0f
format alt0m021  %9.0f
format alt0m022  %9.0f
format alt0m023  %9.0f
format alt0m024  %9.0f
format alt0m025  %9.0f
format alt0m026  %9.0f
format alt0m027  %9.0f
format alt0m028  %9.0f
format alt0m029  %9.0f
format alt0m030  %9.0f
format alt0m031  %9.0f
format alt0m032  %9.0f
format alt0m033  %9.0f
format alt0m034  %9.0f
format alt0m035  %9.0f
format alt0m036  %9.0f
format alt0m037  %9.0f
format alt0m038  %9.0f
format alt0m039  %9.0f
format alt0m040  %9.0f
format alt0m041  %9.0f
format alt0m042  %9.0f
format alt0m043  %9.0f
format alt0m044  %9.0f
format alt0m045  %9.0f
format alt0m046  %9.0f
format alt0m047  %9.0f
format alt0m048  %9.0f
format alt0m049  %9.0f
format alt1m001  %9.1f
format alt1m002  %9.1f
format alt1m003  %9.1f
format alubm001  %9.0f
format alucm001  %9.0f
format alucm002  %9.0f
format alucm003  %9.0f
format alucm004  %9.0f
format alucm005  %9.0f
format alucm006  %9.0f
format alucm007  %9.0f
format alucm008  %9.0f
format alucm009  %9.0f
format alucm010  %9.0f
format alukm001  %9.0f
format alukm002  %9.0f
format alukm003  %9.0f
format alukm004  %9.0f
format alukm005  %9.0f
format alukm006  %9.0f
format alukm007  %9.0f
format alukm008  %9.0f
format alukm009  %9.0f
format alukm010  %9.0f
format alukm011  %9.0f
format alukm012  %9.0f
format alukm013  %9.0f
format alukm014  %9.0f
format alukm015  %9.0f
format alukm016  %9.0f
format alukm017  %9.0f
format alukm018  %9.0f
format alukm019  %9.0f
format alukm020  %9.0f
format alukm021  %9.0f
format alwgm001  %9.0f
format alwgm002  %9.0f
format alwgm003  %9.0f
format alwgm004  %9.0f
format alwgm005  %9.0f
format alwgm006  %9.0f
format alwgm007  %9.0f
format alwgm008  %9.0f
format alwgm009  %9.0f
format alwgm010  %9.0f
format alwgm011  %9.0f
format alwgm012  %9.0f
format alwgm013  %9.0f
format alwgm014  %9.0f
format alwgm015  %9.0f
format alwgm016  %9.0f
format alwgm017  %9.0f
format alwgm018  %9.0f
format alwgm019  %9.0f
format alwgm020  %9.0f
format alwgm021  %9.0f
format alwgm022  %9.0f
format alwgm023  %9.0f
format alwgm024  %9.0f
format alwgm025  %9.0f
format alwvm001  %9.0f
format alwvm002  %9.0f
format alwvm003  %9.0f
format alwvm004  %9.0f
format alwvm005  %9.0f
format alwvm006  %9.0f
format alwvm007  %9.0f
format alwvm008  %9.0f
format alw1m001  %9.0f
format aly3m001  %9.0f
format aly3m002  %9.0f
format aly3m003  %9.0f
format aly3m004  %9.0f
format aly3m005  %9.0f
format aly3m006  %9.0f
format aly3m007  %9.0f

label var year      `"Data File Year"'
label var stusab    `"State Postal Abbreviation"'
label var regiona   `"Region Code"'
label var divisiona `"Division Code"'
label var statea    `"State Code"'
label var countya   `"County Code"'
label var cousuba   `"County Subdivision Code"'
label var placea    `"Place Code"'
label var tracta    `"Census Tract Code"'
label var blkgrpa   `"Block Group Code"'
label var concita   `"Consolidated City Code"'
label var aianhha   `"American Indian Area/Alaska Native Area/Hawaiian Home Land Code"'
label var res_onlya `"American Indian Area/Alaska Native Area (Reservation or Statistical Entity Only)"'
label var trusta    `"American Indian Area (Off-Reservation Trust Land Only)/Hawaiian Home Land Code"'
label var aihhtli   `"American Indian Trust Land/ Hawaiian Home Land Indicator"'
label var aits      `"American Indian Tribal Subdivision (FIPS)"'
label var anrca     `"Alaska Native Regional Corporation Code"'
label var cbsaa     `"Metropolitan Statistical Area/Micropolitan Statistical Area Code"'
label var csaa      `"Combined Statistical Area Code"'
label var metdiva   `"Metropolitan Division Code"'
label var memi      `"Metropolitan/Micropolitan Indicator Flag"'
label var nectaa    `"New England City and Town Area Code"'
label var cnectaa   `"Combined New England City and Town Area Code"'
label var nectadiva `"New England City and Town Area Division Code"'
label var uaa       `"Urban Area Code"'
label var cdcurra   `"Congressional District (2019-2021, 116th Congress) Code"'
label var sldua     `"State Legislative District (Upper Chamber) Code"'
label var sldla     `"State Legislative District (Lower Chamber) Code"'
label var zcta5a    `"5-Digit ZIP Code Tabulation Area Code"'
label var submcda   `"Subminor Civil Division Code"'
label var sdelma    `"School District (Elementary)/Remainder Code"'
label var sdseca    `"School District (Secondary)/Remainder Code"'
label var sdunia    `"School District (Unified)/Remainder Code"'
label var ur        `"Urban/Rural"'
label var pci       `"Principal City Indicator"'
label var puma5a    `"Public Use Microdata Sample Area (PUMA) Code"'
label var geoid     `"Census Geographic Identifier"'
label var bttra     `"Tribal Census Tract Code"'
label var btbga     `"Tribal Block Group Code"'
label var name_e    `"Estimates: Area Name"'
label var alt0e001  `"Estimates: Total"'
label var alt0e002  `"Estimates: Male"'
label var alt0e003  `"Estimates: Male: Under 5 years"'
label var alt0e004  `"Estimates: Male: 5 to 9 years"'
label var alt0e005  `"Estimates: Male: 10 to 14 years"'
label var alt0e006  `"Estimates: Male: 15 to 17 years"'
label var alt0e007  `"Estimates: Male: 18 and 19 years"'
label var alt0e008  `"Estimates: Male: 20 years"'
label var alt0e009  `"Estimates: Male: 21 years"'
label var alt0e010  `"Estimates: Male: 22 to 24 years"'
label var alt0e011  `"Estimates: Male: 25 to 29 years"'
label var alt0e012  `"Estimates: Male: 30 to 34 years"'
label var alt0e013  `"Estimates: Male: 35 to 39 years"'
label var alt0e014  `"Estimates: Male: 40 to 44 years"'
label var alt0e015  `"Estimates: Male: 45 to 49 years"'
label var alt0e016  `"Estimates: Male: 50 to 54 years"'
label var alt0e017  `"Estimates: Male: 55 to 59 years"'
label var alt0e018  `"Estimates: Male: 60 and 61 years"'
label var alt0e019  `"Estimates: Male: 62 to 64 years"'
label var alt0e020  `"Estimates: Male: 65 and 66 years"'
label var alt0e021  `"Estimates: Male: 67 to 69 years"'
label var alt0e022  `"Estimates: Male: 70 to 74 years"'
label var alt0e023  `"Estimates: Male: 75 to 79 years"'
label var alt0e024  `"Estimates: Male: 80 to 84 years"'
label var alt0e025  `"Estimates: Male: 85 years and over"'
label var alt0e026  `"Estimates: Female"'
label var alt0e027  `"Estimates: Female: Under 5 years"'
label var alt0e028  `"Estimates: Female: 5 to 9 years"'
label var alt0e029  `"Estimates: Female: 10 to 14 years"'
label var alt0e030  `"Estimates: Female: 15 to 17 years"'
label var alt0e031  `"Estimates: Female: 18 and 19 years"'
label var alt0e032  `"Estimates: Female: 20 years"'
label var alt0e033  `"Estimates: Female: 21 years"'
label var alt0e034  `"Estimates: Female: 22 to 24 years"'
label var alt0e035  `"Estimates: Female: 25 to 29 years"'
label var alt0e036  `"Estimates: Female: 30 to 34 years"'
label var alt0e037  `"Estimates: Female: 35 to 39 years"'
label var alt0e038  `"Estimates: Female: 40 to 44 years"'
label var alt0e039  `"Estimates: Female: 45 to 49 years"'
label var alt0e040  `"Estimates: Female: 50 to 54 years"'
label var alt0e041  `"Estimates: Female: 55 to 59 years"'
label var alt0e042  `"Estimates: Female: 60 and 61 years"'
label var alt0e043  `"Estimates: Female: 62 to 64 years"'
label var alt0e044  `"Estimates: Female: 65 and 66 years"'
label var alt0e045  `"Estimates: Female: 67 to 69 years"'
label var alt0e046  `"Estimates: Female: 70 to 74 years"'
label var alt0e047  `"Estimates: Female: 75 to 79 years"'
label var alt0e048  `"Estimates: Female: 80 to 84 years"'
label var alt0e049  `"Estimates: Female: 85 years and over"'
label var alt1e001  `"Estimates: Median age: Total"'
label var alt1e002  `"Estimates: Median age: Male"'
label var alt1e003  `"Estimates: Median age: Female"'
label var alube001  `"Estimates: Total"'
label var aluce001  `"Estimates: Total"'
label var aluce002  `"Estimates: White alone"'
label var aluce003  `"Estimates: Black or African American alone"'
label var aluce004  `"Estimates: American Indian and Alaska Native alone"'
label var aluce005  `"Estimates: Asian alone"'
label var aluce006  `"Estimates: Native Hawaiian and Other Pacific Islander alone"'
label var aluce007  `"Estimates: Some other race alone"'
label var aluce008  `"Estimates: Two or more races"'
label var aluce009  `"Estimates: Two or more races: Two races including Some other race"'
label var aluce010  `"Estimates: Two or more races: Two races excluding Some other race, and three or "'
label var aluke001  `"Estimates: Total"'
label var aluke002  `"Estimates: Not Hispanic or Latino"'
label var aluke003  `"Estimates: Not Hispanic or Latino: White alone"'
label var aluke004  `"Estimates: Not Hispanic or Latino: Black or African American alone"'
label var aluke005  `"Estimates: Not Hispanic or Latino: American Indian and Alaska Native alone"'
label var aluke006  `"Estimates: Not Hispanic or Latino: Asian alone"'
label var aluke007  `"Estimates: Not Hispanic or Latino: Native Hawaiian and Other Pacific Islander al"'
label var aluke008  `"Estimates: Not Hispanic or Latino: Some other race alone"'
label var aluke009  `"Estimates: Not Hispanic or Latino: Two or more races"'
label var aluke010  `"Estimates: Not Hispanic or Latino: Two or more races: Two races including Some o"'
label var aluke011  `"Estimates: Not Hispanic or Latino: Two or more races: Two races excluding Some o"'
label var aluke012  `"Estimates: Hispanic or Latino"'
label var aluke013  `"Estimates: Hispanic or Latino: White alone"'
label var aluke014  `"Estimates: Hispanic or Latino: Black or African American alone"'
label var aluke015  `"Estimates: Hispanic or Latino: American Indian and Alaska Native alone"'
label var aluke016  `"Estimates: Hispanic or Latino: Asian alone"'
label var aluke017  `"Estimates: Hispanic or Latino: Native Hawaiian and Other Pacific Islander alone"'
label var aluke018  `"Estimates: Hispanic or Latino: Some other race alone"'
label var aluke019  `"Estimates: Hispanic or Latino: Two or more races"'
label var aluke020  `"Estimates: Hispanic or Latino: Two or more races: Two races including Some other"'
label var aluke021  `"Estimates: Hispanic or Latino: Two or more races: Two races excluding Some other"'
label var alwge001  `"Estimates: Total"'
label var alwge002  `"Estimates: No schooling completed"'
label var alwge003  `"Estimates: Nursery school"'
label var alwge004  `"Estimates: Kindergarten"'
label var alwge005  `"Estimates: 1st grade"'
label var alwge006  `"Estimates: 2nd grade"'
label var alwge007  `"Estimates: 3rd grade"'
label var alwge008  `"Estimates: 4th grade"'
label var alwge009  `"Estimates: 5th grade"'
label var alwge010  `"Estimates: 6th grade"'
label var alwge011  `"Estimates: 7th grade"'
label var alwge012  `"Estimates: 8th grade"'
label var alwge013  `"Estimates: 9th grade"'
label var alwge014  `"Estimates: 10th grade"'
label var alwge015  `"Estimates: 11th grade"'
label var alwge016  `"Estimates: 12th grade, no diploma"'
label var alwge017  `"Estimates: Regular high school diploma"'
label var alwge018  `"Estimates: GED or alternative credential"'
label var alwge019  `"Estimates: Some college, less than 1 year"'
label var alwge020  `"Estimates: Some college, 1 or more years, no degree"'
label var alwge021  `"Estimates: Associate's degree"'
label var alwge022  `"Estimates: Bachelor's degree"'
label var alwge023  `"Estimates: Master's degree"'
label var alwge024  `"Estimates: Professional school degree"'
label var alwge025  `"Estimates: Doctorate degree"'
label var alwve001  `"Estimates: Total"'
label var alwve002  `"Estimates: Under .50"'
label var alwve003  `"Estimates: .50 to .99"'
label var alwve004  `"Estimates: 1.00 to 1.24"'
label var alwve005  `"Estimates: 1.25 to 1.49"'
label var alwve006  `"Estimates: 1.50 to 1.84"'
label var alwve007  `"Estimates: 1.85 to 1.99"'
label var alwve008  `"Estimates: 2.00 and over"'
label var alw1e001  `"Estimates: Median household income in the past 12 months (in 2019 inflation-adju"'
label var aly3e001  `"Estimates: Total"'
label var aly3e002  `"Estimates: In labor force"'
label var aly3e003  `"Estimates: In labor force: Civilian labor force"'
label var aly3e004  `"Estimates: In labor force: Civilian labor force: Employed"'
label var aly3e005  `"Estimates: In labor force: Civilian labor force: Unemployed"'
label var aly3e006  `"Estimates: In labor force: Armed Forces"'
label var aly3e007  `"Estimates: Not in labor force"'
label var name_m    `"Margins of error: Area Name"'
label var alt0m001  `"Margins of error: Total"'
label var alt0m002  `"Margins of error: Male"'
label var alt0m003  `"Margins of error: Male: Under 5 years"'
label var alt0m004  `"Margins of error: Male: 5 to 9 years"'
label var alt0m005  `"Margins of error: Male: 10 to 14 years"'
label var alt0m006  `"Margins of error: Male: 15 to 17 years"'
label var alt0m007  `"Margins of error: Male: 18 and 19 years"'
label var alt0m008  `"Margins of error: Male: 20 years"'
label var alt0m009  `"Margins of error: Male: 21 years"'
label var alt0m010  `"Margins of error: Male: 22 to 24 years"'
label var alt0m011  `"Margins of error: Male: 25 to 29 years"'
label var alt0m012  `"Margins of error: Male: 30 to 34 years"'
label var alt0m013  `"Margins of error: Male: 35 to 39 years"'
label var alt0m014  `"Margins of error: Male: 40 to 44 years"'
label var alt0m015  `"Margins of error: Male: 45 to 49 years"'
label var alt0m016  `"Margins of error: Male: 50 to 54 years"'
label var alt0m017  `"Margins of error: Male: 55 to 59 years"'
label var alt0m018  `"Margins of error: Male: 60 and 61 years"'
label var alt0m019  `"Margins of error: Male: 62 to 64 years"'
label var alt0m020  `"Margins of error: Male: 65 and 66 years"'
label var alt0m021  `"Margins of error: Male: 67 to 69 years"'
label var alt0m022  `"Margins of error: Male: 70 to 74 years"'
label var alt0m023  `"Margins of error: Male: 75 to 79 years"'
label var alt0m024  `"Margins of error: Male: 80 to 84 years"'
label var alt0m025  `"Margins of error: Male: 85 years and over"'
label var alt0m026  `"Margins of error: Female"'
label var alt0m027  `"Margins of error: Female: Under 5 years"'
label var alt0m028  `"Margins of error: Female: 5 to 9 years"'
label var alt0m029  `"Margins of error: Female: 10 to 14 years"'
label var alt0m030  `"Margins of error: Female: 15 to 17 years"'
label var alt0m031  `"Margins of error: Female: 18 and 19 years"'
label var alt0m032  `"Margins of error: Female: 20 years"'
label var alt0m033  `"Margins of error: Female: 21 years"'
label var alt0m034  `"Margins of error: Female: 22 to 24 years"'
label var alt0m035  `"Margins of error: Female: 25 to 29 years"'
label var alt0m036  `"Margins of error: Female: 30 to 34 years"'
label var alt0m037  `"Margins of error: Female: 35 to 39 years"'
label var alt0m038  `"Margins of error: Female: 40 to 44 years"'
label var alt0m039  `"Margins of error: Female: 45 to 49 years"'
label var alt0m040  `"Margins of error: Female: 50 to 54 years"'
label var alt0m041  `"Margins of error: Female: 55 to 59 years"'
label var alt0m042  `"Margins of error: Female: 60 and 61 years"'
label var alt0m043  `"Margins of error: Female: 62 to 64 years"'
label var alt0m044  `"Margins of error: Female: 65 and 66 years"'
label var alt0m045  `"Margins of error: Female: 67 to 69 years"'
label var alt0m046  `"Margins of error: Female: 70 to 74 years"'
label var alt0m047  `"Margins of error: Female: 75 to 79 years"'
label var alt0m048  `"Margins of error: Female: 80 to 84 years"'
label var alt0m049  `"Margins of error: Female: 85 years and over"'
label var alt1m001  `"Margins of error: Median age: Total"'
label var alt1m002  `"Margins of error: Median age: Male"'
label var alt1m003  `"Margins of error: Median age: Female"'
label var alubm001  `"Margins of error: Total"'
label var alucm001  `"Margins of error: Total"'
label var alucm002  `"Margins of error: White alone"'
label var alucm003  `"Margins of error: Black or African American alone"'
label var alucm004  `"Margins of error: American Indian and Alaska Native alone"'
label var alucm005  `"Margins of error: Asian alone"'
label var alucm006  `"Margins of error: Native Hawaiian and Other Pacific Islander alone"'
label var alucm007  `"Margins of error: Some other race alone"'
label var alucm008  `"Margins of error: Two or more races"'
label var alucm009  `"Margins of error: Two or more races: Two races including Some other race"'
label var alucm010  `"Margins of error: Two or more races: Two races excluding Some other race, and th"'
label var alukm001  `"Margins of error: Total"'
label var alukm002  `"Margins of error: Not Hispanic or Latino"'
label var alukm003  `"Margins of error: Not Hispanic or Latino: White alone"'
label var alukm004  `"Margins of error: Not Hispanic or Latino: Black or African American alone"'
label var alukm005  `"Margins of error: Not Hispanic or Latino: American Indian and Alaska Native alon"'
label var alukm006  `"Margins of error: Not Hispanic or Latino: Asian alone"'
label var alukm007  `"Margins of error: Not Hispanic or Latino: Native Hawaiian and Other Pacific Isla"'
label var alukm008  `"Margins of error: Not Hispanic or Latino: Some other race alone"'
label var alukm009  `"Margins of error: Not Hispanic or Latino: Two or more races"'
label var alukm010  `"Margins of error: Not Hispanic or Latino: Two or more races: Two races including"'
label var alukm011  `"Margins of error: Not Hispanic or Latino: Two or more races: Two races excluding"'
label var alukm012  `"Margins of error: Hispanic or Latino"'
label var alukm013  `"Margins of error: Hispanic or Latino: White alone"'
label var alukm014  `"Margins of error: Hispanic or Latino: Black or African American alone"'
label var alukm015  `"Margins of error: Hispanic or Latino: American Indian and Alaska Native alone"'
label var alukm016  `"Margins of error: Hispanic or Latino: Asian alone"'
label var alukm017  `"Margins of error: Hispanic or Latino: Native Hawaiian and Other Pacific Islander"'
label var alukm018  `"Margins of error: Hispanic or Latino: Some other race alone"'
label var alukm019  `"Margins of error: Hispanic or Latino: Two or more races"'
label var alukm020  `"Margins of error: Hispanic or Latino: Two or more races: Two races including Som"'
label var alukm021  `"Margins of error: Hispanic or Latino: Two or more races: Two races excluding Som"'
label var alwgm001  `"Margins of error: Total"'
label var alwgm002  `"Margins of error: No schooling completed"'
label var alwgm003  `"Margins of error: Nursery school"'
label var alwgm004  `"Margins of error: Kindergarten"'
label var alwgm005  `"Margins of error: 1st grade"'
label var alwgm006  `"Margins of error: 2nd grade"'
label var alwgm007  `"Margins of error: 3rd grade"'
label var alwgm008  `"Margins of error: 4th grade"'
label var alwgm009  `"Margins of error: 5th grade"'
label var alwgm010  `"Margins of error: 6th grade"'
label var alwgm011  `"Margins of error: 7th grade"'
label var alwgm012  `"Margins of error: 8th grade"'
label var alwgm013  `"Margins of error: 9th grade"'
label var alwgm014  `"Margins of error: 10th grade"'
label var alwgm015  `"Margins of error: 11th grade"'
label var alwgm016  `"Margins of error: 12th grade, no diploma"'
label var alwgm017  `"Margins of error: Regular high school diploma"'
label var alwgm018  `"Margins of error: GED or alternative credential"'
label var alwgm019  `"Margins of error: Some college, less than 1 year"'
label var alwgm020  `"Margins of error: Some college, 1 or more years, no degree"'
label var alwgm021  `"Margins of error: Associate's degree"'
label var alwgm022  `"Margins of error: Bachelor's degree"'
label var alwgm023  `"Margins of error: Master's degree"'
label var alwgm024  `"Margins of error: Professional school degree"'
label var alwgm025  `"Margins of error: Doctorate degree"'
label var alwvm001  `"Margins of error: Total"'
label var alwvm002  `"Margins of error: Under .50"'
label var alwvm003  `"Margins of error: .50 to .99"'
label var alwvm004  `"Margins of error: 1.00 to 1.24"'
label var alwvm005  `"Margins of error: 1.25 to 1.49"'
label var alwvm006  `"Margins of error: 1.50 to 1.84"'
label var alwvm007  `"Margins of error: 1.85 to 1.99"'
label var alwvm008  `"Margins of error: 2.00 and over"'
label var alw1m001  `"Margins of error: Median household income in the past 12 months (in 2019 inflati"'
label var aly3m001  `"Margins of error: Total"'
label var aly3m002  `"Margins of error: In labor force"'
label var aly3m003  `"Margins of error: In labor force: Civilian labor force"'
label var aly3m004  `"Margins of error: In labor force: Civilian labor force: Employed"'
label var aly3m005  `"Margins of error: In labor force: Civilian labor force: Unemployed"'
label var aly3m006  `"Margins of error: In labor force: Armed Forces"'
label var aly3m007  `"Margins of error: Not in labor force"'


****************************************************************
* (Yilin's code below)
****************************************************************
* create demographics variable

* lists of variable to create:
* population
* race // share Black, white and Hispanic
* gender // share male
* age the resident share in each age group (<14, 15-24, 25-44, >45)
* poverty rate
* median household income
* unemployment rate.
* education

* male share
ren alt0e001 tot_pop_acs_15_19
gen pct_male_acs_15_19 = alt0e002/tot_pop_acs_15_19

/*
label var aluke001  `"Estimates: Total"'
label var aluke002  `"Estimates: Not Hispanic or Latino"'
label var aluke003  `"Estimates: Not Hispanic or Latino: White alone"'
label var aluke004  `"Estimates: Not Hispanic or Latino: Black or African American alone"'
label var aluke005  `"Estimates: Not Hispanic or Latino: American Indian and Alaska Native alone"'
label var aluke006  `"Estimates: Not Hispanic or Latino: Asian alone"'
label var aluke007  `"Estimates: Not Hispanic or Latino: Native Hawaiian and Other Pacific Islander al"'
label var aluke008  `"Estimates: Not Hispanic or Latino: Some other race alone"'
label var aluke009  `"Estimates: Not Hispanic or Latino: Two or more races"'
label var aluke010  `"Estimates: Not Hispanic or Latino: Two or more races: Two races including Some o"'
label var aluke011  `"Estimates: Not Hispanic or Latino: Two or more races: Two races excluding Some o"'
label var aluke012  `"Estimates: Hispanic or Latino"'
*/

gen pct_hisp_latino_acs_15_19 = aluke012/aluke001
gen pct_nh_white_alone_acs_15_19 = aluke003/aluke001
gen pct_nh_blk_alone_acs_15_19 = aluke004/aluke001
gen pct_nh_aian_alone_acs_15_19 = aluke005/aluke001
gen pct_nh_asian_alone_acs_15_19 = aluke006/aluke001


gen pct_pop_under_5_acs_15_19 = (alt0e003 + alt0e027)/tot_pop_acs_15_19
gen pct_pop_5_17_acs_15_19 = (alt0e004 + alt0e005 + alt0e006 + alt0e028 + alt0e029 + alt0e030)/tot_pop_acs_15_19
gen pct_pop_18_24_acs_15_19 = (alt0e007 + alt0e008 + alt0e009 + alt0e010 + alt0e031 + alt0e032 + alt0e033 + alt0e034)/tot_pop_acs_15_19
gen pct_pop_25_44_acs_15_19 = (alt0e011 + alt0e012 + alt0e013 + alt0e014 + alt0e035 + alt0e036 + alt0e037 + alt0e038)/tot_pop_acs_15_19
gen pct_pop_45_64_acs_15_19 = (alt0e015 + alt0e016 + alt0e017 + alt0e018 + alt0e019  + alt0e039 + alt0e040 + alt0e041 + alt0e042 + alt0e043)/tot_pop_acs_15_19
gen pct_pop_65plus_acs_15_19 = (alt0e020 + alt0e021 + alt0e022 + alt0e023 + alt0e024 + alt0e025 + alt0e044 + alt0e045 + alt0e046 + alt0e047 + alt0e048 + alt0e049)/tot_pop_acs_15_19


/*
label var aly3e003  `"Estimates: In labor force: Civilian labor force"'
label var aly3e004  `"Estimates: In labor force: Civilian labor force: Employed"'
label var aly3e005  `"Estimates: In labor force: Civilian labor force: Unemployed"'
*/
gen unemploy_rate_acs_15_19 = aly3e005/aly3e003


/*
label var alwge001  `"Estimates: Total"'
label var alwge002  `"Estimates: No schooling completed"'
label var alwge003  `"Estimates: Nursery school"'
label var alwge004  `"Estimates: Kindergarten"'
label var alwge005  `"Estimates: 1st grade"'
label var alwge006  `"Estimates: 2nd grade"'
label var alwge007  `"Estimates: 3rd grade"'
label var alwge008  `"Estimates: 4th grade"'
label var alwge009  `"Estimates: 5th grade"'
label var alwge010  `"Estimates: 6th grade"'
label var alwge011  `"Estimates: 7th grade"'
label var alwge012  `"Estimates: 8th grade"'
label var alwge013  `"Estimates: 9th grade"'
label var alwge014  `"Estimates: 10th grade"'
label var alwge015  `"Estimates: 11th grade"'
label var alwge016  `"Estimates: 12th grade, no diploma"'
label var alwge017  `"Estimates: Regular high school diploma"'
label var alwge018  `"Estimates: GED or alternative credential"'
label var alwge019  `"Estimates: Some college, less than 1 year"'
label var alwge020  `"Estimates: Some college, 1 or more years, no degree"'
label var alwge021  `"Estimates: Associate's degree"'
label var alwge022  `"Estimates: Bachelor's degree"'
label var alwge023  `"Estimates: Master's degree"'
label var alwge024  `"Estimates: Professional school degree"'
label var alwge025  `"Estimates: Doctorate degree"'

*/

* education
* note: denominator - ACS Pop 25+ (alwge001)

gen not_hs_grad_acs_15_19 = alwge002 + alwge003 + alwge004 + alwge005 + alwge006 + alwge007 + alwge008 + alwge009 + alwge010 + alwge011 + alwge012 + alwge013 + alwge014 + alwge015 + alwge016
gen pct_not_hs_grad_acs_15_19 = not_hs_grad_acs_15_19/alwge001

* college and above
gen pct_college_acs_15_19 = (alwge022 + alwge023 + alwge024 + alwge025)/alwge001

* poverty share
gen pov_share_acs_15_19 = (alwve002 + alwve003)/alwve001

ren alt1e001 median_age
ren alw1e001 med_hhc_inc_acs_15_19

* keep only 
keep zcta5a *acs_15_19 

rename zcta5a zcta
destring zcta, replace 

save "ZCTA_demographics_acs_15_19.dta",replace
